package com.itheima.mapper;


import com.itheima.pojo.Order;
import com.itheima.pojo.OrderTOD;
import com.itheima.pojo.OrderVO;
import com.itheima.pojo.OrderVO2;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface OrderDao {
    
    @Select("select count(*) from t_order")
    Long findCount();

    List<OrderVO> findPage(int start, int end, String queryString);

    @Update("update t_order set orderStatus = #{orderStatus} where id = #{id}")
    void update(Order order);

    @Select("select o.orderType,m.name as member,o.orderDate,s.code as setmeal from t_order o,t_member m ,t_setmeal s where o.member_id = m.id and o.setmeal_id = s.id and o.id = #{id}")
    OrderVO2 findById(Integer id);

    @Select("select o.id from t_order o , t_member m where o.member_id = m.id and o.orderDate=#{orderDate} and o.setmeal_id = #{setmealId} and m.name=#{name}")
    Long findByNameAndOrderDateAndSetmeal(OrderTOD orderTOD);


    void add(Order order);
}
